package com.gqz.patrol.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gqz.common.core.domain.R;
import com.gqz.common.core.domain.RequestForm;
import com.gqz.patrol.api.EnInterfaceCodeApi;
import com.gqz.patrol.service.IEnInterfaceCodeService;
import com.gqz.patrol.vo.EnInterfaceCodeVo;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EnInterfaceCodeController implements EnInterfaceCodeApi {

    @Autowired
    private IEnInterfaceCodeService service;

    @Override
    public R<List<EnInterfaceCodeVo>> getById(String id) {
        return R.ok(service.getById(id));
    }

    @Override
    public R<Page<EnInterfaceCodeVo>> page(@Valid RequestForm<EnInterfaceCodeVo> requestForm) {
        return R.ok(service.page(requestForm));
    }

    @Override
    public R<Long> count(@Valid RequestForm<EnInterfaceCodeVo> requestForm) {
        return R.ok(service.count(requestForm));
    }

    @Override
    public R<Integer> insert(@Valid List<EnInterfaceCodeVo> vos) {
        return R.ok(service.insert(vos));
    }

    @Override
    public R<Integer> update(@Valid List<EnInterfaceCodeVo> vos) {
        return R.ok(service.update(vos));
    }

    @Override
    public R<Boolean> delete(@Valid List<String> ids) {
        return R.ok(service.removeBatchByIds(ids));
    }

}
